﻿
<p>
Add Chart Service to the DI container by using the extension AddApexCharts().
This will add a scoped IApexChartService to the container.
</p>

For Blazor projects running in a web browser, WinForms, or WPF.
<CodeFormatter Code="@codeMinimal" />

For Blazor projects running in a MAUI application.
<CodeFormatter Code="@codeMinimalMaui" />

Or, optional add global options
<CodeFormatter Code="@codeGlobalOptions" />




@code {

    [Inject] public IApexChartService ChartService { get; set; }
    private string codeMinimal = @"services.AddApexCharts();";
    private string codeMinimalMaui = @"services.AddApexCharts();";
    private string codeGlobalOptions = @"services.AddApexCharts(e =>
            {
                e.GlobalOptions = new ApexChartBaseOptions
                {
                    Debug = true,
                    Theme = new Theme { Palette = PaletteType.Palette6 }
                };
            });";

    protected override async Task OnInitializedAsync()
    {
        await ChartService.InitalizeChartAsync();
    }

}